﻿@model List<KPIS.GERP.SERVICE.Model.message>
@using KPIS.GERP.MVC.Classes
@{ 
    ViewBag.Title = "กล่องข้อความของคุณ";
    var ssMng = new SsMng();
}
<h2>@ViewBag.Title</h2>
 
@(Html.Telerik().Grid(Model)
    .Name("dtgMessage")
    .DataKeys(keys => keys.Add(m => m.message_seq))
    .Columns(columns =>
        {
            columns.Bound(m => m.message_status).ClientTemplate(
                "<img src='" + (ssMng.PortNumber == 80 ? "/OMVC" : "") + "/Images/Icons/Message<#= message_status #>.jpg' title='<#= message_status_string #>' width='24' height='24'/>")
                .Width(40)
                .Filterable(true)
                .Title("");
            columns.Bound(m => m.message_seq)
                .Visible(false);
            columns.Bound(m => m.message_date)
                .Format("{0:dd/MM/yyyy HH:mm}")
                .Width(150)
                .Filterable(true)
                .Title("วันที่ส่ง");
            columns.Bound(m => m.from_hrm_ps_employees.full_name)
                .Title("ผู้ส่ง")
                .Filterable(true)
                .Width(200);
            columns.Bound(m => m.from_hrm_ps_employees.hrm_mp_job_sites.job_site_name)
                .Title("หน่วยงาน")
                .Filterable(true)
                .Width(200);
            columns.Bound(m => m.message_title).ClientTemplate(
                "<a href='" + Url.Action("ViewDetails", "Message", new {message_seq = "<#= message_seq #>", mode = Request["mode"]}) +
                "' title='<#= message_descr #>'><div class='titlemessage'><#= message_title #></div> </a>").Title("ข้อความ");
        })
    .DataBinding(dataBinding => dataBinding.Ajax().Select("_AjaxBinding", "Message"))
    .Pageable(o=>o.PageSize(100))
    .Scrollable(scrolling => scrolling.Height(new SsMng().Height))
    .Sortable()
    .Filterable()
      )

<style>
    .titlemessage {
        margin: 0 0 0 0;
        padding: 0 0 0 0;
        cursor: pointer;
    } 
    .titlemessage:hover {
        cursor: pointer;
        color: white;
        background: rgb(59, 89, 151);
    } 

</style>